<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Products.xsl
    Created on : September 30, 2013, 12:45 PM
    Author     : Vinh Nguyen
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:param name="searchKey"/>
    <xsl:template match="products">
        <table border="2" width="75%">
            <xsl:for-each select="product[contains(productName, $searchKey)]">
                <tr>
                    <td>
                        <xsl:value-of select="imagePath"/>
                    </td>
                    <td>
                        <xsl:variable name="unit_id">
                            <xsl:value-of select="id" />
                        </xsl:variable>
                        <a href="processServlet?btnAction=detail&amp;id={$unit_id}">
                            <xsl:value-of select="productName"/>
                        </a>
                    </td>
                    <td>
                        <xsl:value-of select="price"/>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>
